-
Notifications
You must be signed in to change notification settings - Fork 461
Catch EMS variables initialized after reference #11409
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
…ter reference does not throw error.
|
As I understand it, Windows builds don't pick up uninitialized variables, which we treat as errors. /home/mitchute/Projects/EnergyPlus/tst/EnergyPlus/unit/EMSManager.unit.cc:1065:9: error: unused variable ‘wallSurfNum’ [-Werror=unused-variable]
1065 | int wallSurfNum = Util::FindItemInList("WALL", state->dataSurface->Surface);
| ^~~~~~~~~~~ |
|
This PR is about the EMS variable |
| " Set power_mult = site_temp_adj, !- Program Line 1", | ||
| " Set site_temp_adj = 0.1, !- Program Line 2", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Variable site_temp_adj is being initialized after it is referenced. We should expect an error, right?
| int wallSurfNum = Util::FindItemInList("WALL", state->dataSurface->Surface); | ||
| bool anyRan; | ||
| EMSManager::ManageEMS(*state, EMSManager::EMSCallFrom::BeginTimestepBeforePredictor, anyRan, ObjexxFCL::Optional_int_const()); | ||
| EXPECT_EQ(state->dataSurface->Surface(wallSurfNum).ViewFactorGround, 0.1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I intentionally had this line commented out so that we could get to EXPECT_TRUE(seriousErrorFound); down below.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, feel free to do what you need. I won't interfere anymore until you need someone to look. I was just pointing out that the CI linux builds were failing due to to the unused variable, that we treat as an error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No problem, understood.
… just ManageSimulation.
|
Pretty sure I have this narrowed down. I think |
|
|
||
| internalVarNum = RuntimeLanguageProcessor::FindEMSVariable(*state, "site_temp_adj", 1); | ||
| ASSERT_GT(internalVarNum, 0); | ||
| EXPECT_TRUE(state->dataRuntimeLang->ErlVariable(internalVarNum).Value.initialized); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the main difference with the first test; why is this suddenly initialized?
It's not in I'm not totally sure what the fix is here. Perhaps |
| Output:EnergyManagementSystem, | ||
| Verbose, !- Actuator Availability Dictionary Reporting | ||
| Verbose, !- Internal Variable Availability Dictionary Reporting | ||
| Verbose; !- EMS Runtime Language Debug Output Level |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test file has a program (BeginZoneTimestepAfterInitHeatBalance) that uses variables which are initialized in another program/subroutine (EndOfSystemTimestepAfterHVACReporting). I.e., initialized after reference.
| Run CalcBouyancyTerms, !- <none> | ||
| SEt Numerator = WindMCT + NatBouyMCT + SumHATroof + QdotCond + SumReliefMCT, !- <none> | ||
| Set Numerator = WindMCT + NatBouyMCT + SumHATroof + QdotCond + SumReliefMCT, !- <none> | ||
| Set Denominator = WindMC + NatBouyMC + SumHAroof + SumIntakeMdotCp, !- <none> | ||
| Set Troof = Numerator / Denominator, !- <none> | ||
| IF Ta < 2.0, !- <none> | ||
| Set Troof = Ta, !- <none> | ||
| ENDIF, !- <none> | ||
| IF Troof < Twb, !- <none> | ||
| Set Twb = Troof - 0.2, !- <none> | ||
| ENDIF; !- <none> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Something weird going on in this program. Here Troof is a function of, e.g., NatBouyMCT. Subroutine CalcBouyancyTerms needs Troof, which is used to calculate NatBouyMCT... am I missing something here?
| if ((!state.dataGlobal->DoingSizing && !state.dataGlobal->KickOffSimulation && !state.dataEMSMgr->FinishProcessingUserInput) || | ||
| (!(thisErlVar.SetByGlobalVariable || thisErlVar.SetByInternalVariable))) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The basic idea here is to do what we were doing before, unless the uninitialized variable is either a global/internal variable. If it isn't global/internal, set seriousErrorFound = true. If it is, let it slide.
|
|

Pull request overview
Description of the purpose of this PR
Pull Request Author
Reviewer